import { Dict } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name 字典管理模块
 */
// 获取字典列表
export const getDictList = (params: String) => {
  return http.post(PORT1 + `/query/JJ0003`, params);
};
// 获取字典分类
export const getDictSelect = (params: String) => {
  return http.post(PORT1 + `/query/JJ0004`, params);
};

// 新增字典
export const addDict = (params: Dict.ReqDictParams) => {
  return http.post(PORT1 + `/work/IN0009`, params);
};
// 新增选项
export const addDictSelection = (params: Dict.ReqDictParams) => {
  return http.post(PORT1 + `/work/IN0010`, params);
};

// 编辑字典
export const editDict = (params: Dict.ReqDictParams) => {
  return http.post(PORT1 + `/dict/edit`, params);
};

// 删除字典
export const deleteDict = (params: { id: string[] }) => {
  return http.post(PORT1 + `/dict/delete`, params);
};
// 删除字典
export const delteDictSelection = (params: { id: string[] }) => {
  return http.post(PORT1 + `/work/IN0012`, params);
};

// 导出字典数据
export const exportDictInfo = (params: Dict.ReqDictParams) => {
  return http.download(PORT1 + `/dict/export`, params);
};

// 获取字典状态字典
export const getDictStatus = () => {
  return http.get<Dict.ResStatus[]>(PORT1 + `/dict/status`);
};
